home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue57 / DataAwar / Listing4.pas < prev   
Encoding:
Pascal/Delphi Source File  |  2000-04-04  |  676 b   |  26 lines

  1. procedure LoadList (ListView: TListView; DataSet: TDataSet; Fields: array of String);
  2. var
  3.   Index: Integer;
  4. begin
  5.   Screen.Cursor := crHourGlass;
  6.   ListView.Items.BeginUpdate;
  7.   try
  8.     ListView.Items.Clear;
  9.     DataSet.First;
  10.     while not DataSet.EOF do begin
  11.       with ListView.Items.Add do begin
  12.         Caption := Fields[0];
  13.         for Index := 1 to High (Fields) do begin
  14.           SubItems.Add (DataSet.FieldByName (Index).AsString);
  15.         end;
  16.       end;
  17.       DataSet.Next;
  18.     end;
  19.   finally
  20.     Screen.Cursor := crDefault;
  21.     ListView.Items.EndUpdate;
  22.   end;
  23. end;
  24.  
  25. LoadList (lvwOrders, OrderDataSet, ['Date', 'Price', 'Description']);
  26.